﻿using Diploma.Models.IRepositories;

namespace Diploma.Models.Repositories
{
    internal class RolesRepository : IRolesRepository
    {
        private readonly UsersRepository usersRepository;

        public RolesRepository(DiplomaEntities dataContext)
        {
            usersRepository = new UsersRepository(dataContext);
        }

        public string[] GetRolesForUser(string userEmail)
        {
            var user = usersRepository.GetUserByEmail(userEmail, false);
            if (user == null)
            {
                return new string[] {};
            }
            return new[] { user.GetType().Name };
        }
    }
}